home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
Apps
/
ScreenSavers
/
BackSpaceViews
/
SparseLifeView.BackModule
/
SparseLifeView.h
< prev
next >
Wrap
Text File
|
1995-06-12
|
3KB
|
104 lines
#import <appkit/View.h>
#define ITERATIONS 20000/* max # of iterations before restarting */
#define PANELTIME 333 /* ms delay between *panel* animation frames */
#define DEEPEDGE 2 /* edge is this # squares beyond visible */
#define MINCELLSIZE 2 /* Make sure cell size gets no smaller than... */
#define MAXCELLSIZE 24 /* Make sure cell size gets no bigger than... */
#define COLORS 24 /* Generations from youngest color to oldest color */
#define SQUAREBLOCK 64 /* Number of squares of one color to draw at once */
#define STATSIZE 1024 /* Recognizes all stasis periods up to this number */
#define STATIVAL 128 /* Takes up to this long to recognize stasis */
#ifdef DEEPEDGE
# define MAXCOLS (1280/MINCELLSIZE+2+2*DEEPEDGE)
# define MAXROWS (1024/MINCELLSIZE+2+2*DEEPEDGE)
#else
# define MAXCOLS (1280/MINCELLSIZE+2) /* full screen of smallest cells (x) */
# define MAXROWS (1024/MINCELLSIZE+2) /* (y) */
#endif
typedef struct _lifecell {
int next;
char neighbors;
char color;
} lifecell;
@interface SparseLifeView:View
{
lifecell Grid[MAXCOLS*MAXROWS];
int ifirst;
int ncols, nrows;
int countDown;
int installedCountDown;
int cellSize;
int xoffset, yoffset;
NXColor youngColor;
NXColor mediumColor;
NXColor oldColor;
NXColor colorTable[COLORS];
int squareCount[COLORS];
NXRect squareBuffer[COLORS][SQUAREBLOCK];
int stasis[STATSIZE];
int strack;
int spass;
int sindex;
id sharedInspectorPanel;
id panelYoungColorWell;
id panelMediumColorWell;
id panelOldColorWell;
id panelRestartButton;
id panelStepButton;
id panelLifeView;
id panelCreditsView;
id panelSizeMatrix;
}
- oneStep;
- drawSquares;
- putSquare:(int)x :(int)y Color:(int)color;
- flushColor:(int)color;
- flushSquares;
- drawSelf:(const NXRect *)rects :(int)rectCount;
- (const char *) windowTitle;
- setupSquareBuffer;
- initFrame:(const NXRect *)frameRect;
- getLifeDefaults;
- sizeTo:(NXCoord)width :(NXCoord)height;
- initLife;
- clearLife;
- checkStasis:(int)checksum;
- computeColors;
- updateViews;
- inspector:sender;
- inspectorInstalled;
- takeYoungColorFrom:sender;
- takeMediumColorFrom:sender;
- takeOldColorFrom:sender;
- doSizeMatrix:sender;
- doSingleStep:sender;
- doRestart:sender;
- showCredits:sender;
- hideCredits:sender;
- doShowCredits:sender;
- doHideCredits:sender;
@end
@interface StaticSparseLifeView:SparseLifeView
{
}
- setYoungColor:(NXColor)yc MediumColor:(NXColor)mc OldColor:(NXColor)oc;
- setLifeCellSize:(int)cs;
@end